#define _CRT_SECURE_NO_WARNINGS 1
/**
*      author: Y_Yao
*      created: 2025-02-21 21:57:16
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 15 + 7;
const int M = 100 + 7;
int a[M][M];
int n, m, k;
char is_ok[M];
int b[N];
int ans;

void check()
{
    for (int i = 1;i <= m;i++)
    {
        int cnt = 0;
        for (int j = 1;j <= a[i][0];j++)
        {
            cnt += b[a[i][j]];
        }
        if ((cnt >= k) != (is_ok[i] == 'o'))
        {
            return;
        }
    }
    ans++;
}

void dfs(int cur)
{
    if (cur == n + 1)
    {
        check();
        return;
    }

    for (int i = 0;i <= 1;i++)
    {
        b[cur] = i;
        dfs(cur + 1);
    }
}

void solve()
{
    cin >> n >> m >> k;
    for (int i = 1;i <= m;i++)
    {
        cin >> a[i][0];
        for (int j = 1;j <= a[i][0];j++)
        {
            cin >> a[i][j];
        }
        cin >> is_ok[i];
    }

    dfs(1);
    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    //cin >> t;
    while (t--)
    {
        solve();
    }
    return 0;
}